package com.bw.shop2208a.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bw.shop2208a.R
import com.bw.shop2208a.entity.DataGoodsEntity
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class GoodsSearchAdapter:BaseMultiItemQuickAdapter<DataGoodsEntity,BaseViewHolder>() {
    init {
        addItemType(0,R.layout.item_search_goods)
        addItemType(1,R.layout.item_search_goods1)
    }
    override fun convert(holder: BaseViewHolder, item: DataGoodsEntity) {
        when(holder.itemViewType){
            1->{val iv: ImageView = holder.getView(R.id.iv)
                Glide.with(iv).load(item.goods_default_icon).into(iv)
                holder.setText(R.id.tv, item.goods_desc)}
            0->{val iv: ImageView = holder.getView(R.id.iv)
                Glide.with(iv).load(item.goods_default_icon).into(iv)
                holder.setText(R.id.tv, item.goods_desc)}
        }


    }
}